import { useState } from 'react';

export default () => {
  const [generateList, setGenerateList] = useState([]);
  const [tabLableList, setTabLableList] = useState([]);

  const setGenerateAndTabList = (data) => {
    setGenerateList(data);
    const list = [];
    data.forEach((item) => {
      if (!list.includes(item?.[0]?.product)) {
        list.push(item?.[0]?.product);
      }
    });
    setTabLableList(list);
  };

  return {
    generateList,
    tabLableList,
    setGenerateAndTabList,
  };
};
